package test3_6;

public class homework4_10 {
    public static void main(String[] args) {
        /*
        百钱买百鸡，有100元钱，要去买100只鸡
        公鸡5元一只，母鸡3元一只，小鸡1元3只
        问公，母，小鸡各买多少只。提示： a+b+c=100 只,5a+3b+1/3c=100钱
         */
        for (int Rooster = 0; Rooster <= 20; Rooster++) {
            for (int Hen = 0; Hen <= 33; Hen++) {;
                int Chick = 100 - Rooster - Hen;
                if (Chick >= 0 && Chick % 3 == 0 && 5 * Rooster + 3 * Hen + Chick / 3 == 100) {
                    System.out.println("公鸡" + Rooster + "只 " + "母鸡" + Hen + "只 " + "小鸡" + Chick + "只");
                }
            }
        }
    }
}
